home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
BBS-Archive
/
Comm
/
term-source.lha
/
Extras
/
Source
/
term-Source.lha
/
ScreenPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-17
|
46KB
|
1,711 lines
/*
** ScreenPanel.c
**
** Editing panel for screen configuration
**
** Copyright © 1990-1995 by Olaf `Olsen' Barthel
** All Rights Reserved
*/
#include "termGlobal.h"
enum { GAD_SCREENMODE=1,GAD_USE_PUBSCREEN,GAD_PUBSCREENNAME,GAD_FONT,
GAD_COLOURMODE,GAD_SCREENTITLE,GAD_MAKESCREENPUBLIC,GAD_SHANGHAI,
GAD_BLINKING,GAD_PALETTE,GAD_RED,GAD_GREEN,GAD_BLUE,GAD_RESET,
GAD_STDPENS,GAD_EDITPENS,GAD_WINDOW_BORDER,GAD_SPLIT_STATUS,
GAD_STATUS_LINE,GAD_PAGER,GAD_PAGEGROUP,
GAD_USE,GAD_CANCEL,GAD_DEFAULT };
/* ModeFilter(register __a1 ULONG ID):
*
* Screen display mode filter, rejects all
* modes unapproriate for screen display.
*/
STATIC ULONG __saveds __asm
ModeFilter(register __a1 ULONG ID)
{
struct DimensionInfo DimensionInfo;
if(GetDisplayInfoData(NULL,(APTR)&DimensionInfo,sizeof(struct DimensionInfo),DTAG_DIMS,ID))
{
if(DimensionInfo . TxtOScan . MaxX - DimensionInfo . TxtOScan . MinX + 1 >= 640)
return(TRUE);
}
return(FALSE);
}
STATIC BYTE __regargs
IsWrongMode(struct Configuration *LocalConfig,WORD OriginalMode)
{
if(LocalConfig -> ScreenConfig -> ColourMode != OriginalMode || LocalConfig -> ScreenConfig -> UseWorkbench || Config -> ScreenConfig -> UseWorkbench || !Screen)
return(TRUE);
else
{
LONG Depth;
Depth = GetBitMapDepth(Window -> WScreen -> RastPort . BitMap);
switch(LocalConfig -> ScreenConfig -> ColourMode)
{
case COLOUR_AMIGA:
if(Depth < 2)
return(TRUE);
break;
case COLOUR_EIGHT:
if(Depth < 3)
return(TRUE);
break;
case COLOUR_SIXTEEN:
if(Depth < 4)
return(TRUE);
break;
}
return(FALSE);
}
}
STATIC BYTE __regargs
SelectDisplayMode(struct Window *Window,ULONG *CurrentMode,struct Configuration *Config)
{
BYTE Success = FALSE;
if(AslBase -> lib_Version < 38)
{
struct List *ModeList;
LONG Index;
if(ModeList = BuildModeList(&Index,*CurrentMode,ModeFilter))
{
struct LayoutHandle *Handle;
if(Handle = LT_CreateHandleTags(Window -> WScreen,
LH_LocaleHook, &LocaleHook,
TAG_DONE))
{
struct Window *LocalWindow;
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, LISTVIEW_KIND,
LA_LabelID, MSG_V36_0160,
GTLV_Labels, ModeList,
LA_LONG, &Index,
LALV_CursorKey, TRUE,
LALV_Link, NIL_LINK,
LALV_MaxGrowY, 20,
LALV_ResizeY, TRUE,
LA_Lines, 10,
LA_Chars, 40,
LA_CursorKey, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type,VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, XBAR_KIND,
LAXB_FullSize, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,LA_Type,HORIZONTAL_KIND,
LAGR_SameSize, TRUE,
LAGR_Spread, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_USE_GAD,
LA_ID, GAD_USE,
LABT_ReturnKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_CANCEL_GAD,
LA_ID, GAD_CANCEL,
LABT_EscKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
if(LocalWindow = LT_Layout(Handle,LocaleString(MSG_V36_0161),NULL,0,0,IDCMP_CLOSEWINDOW,NULL,
LAWN_HelpHook, &GuideHook,
LAWN_Parent, Window,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_DragBar, TRUE,
WA_RMBTrap, TRUE,
WA_Activate, TRUE,
TAG_DONE))
{
struct IntuiMessage *Message;
BOOL Done = FALSE;
ULONG MsgClass,
MsgQualifier;
UWORD MsgCode;
struct Gadget *MsgGadget;
LONG i;
struct ModeNode *ModeNode;
do
{
WaitPort(LocalWindow -> UserPort);
while(Message = (struct IntuiMessage *)LT_GetIMsg(Handle))
{
MsgClass = Message -> Class;
MsgCode = Message -> Code;
MsgQualifier = Message -> Qualifier;
MsgGadget = (struct Gadget *)Message -> IAddress;
LT_ReplyIMsg(Message);
if(MsgClass == IDCMP_CLOSEWINDOW)
Done = TRUE;
if(MsgClass == IDCMP_GADGETUP)
{
switch(MsgGadget -> GadgetID)
{
case GAD_USE:
for(ModeNode = (struct ModeNode *)ModeList -> lh_Head, i = 0; ModeNode -> VanillaNode . ln_Succ ; ModeNode = (struct ModeNode *)ModeNode -> VanillaNode . ln_Succ, i++)
{
if(Index == i)
{
*CurrentMode = ModeNode -> DisplayID;
break;
}
}
Success = Done = TRUE;
break;
case GAD_CANCEL:
Done = TRUE;
break;
}
}
if(MsgClass == IDCMP_IDCMPUPDATE)
{
for(ModeNode = (struct ModeNode *)ModeList -> lh_Head, i = 0; ModeNode -> VanillaNode . ln_Succ ; ModeNode = (struct ModeNode *)ModeNode -> VanillaNode . ln_Succ, i++)
{
if(Index == i)
{
*CurrentMode = ModeNode -> DisplayID;
Success = Done = TRUE;
LT_PressButton(Handle,GAD_USE);
break;
}
}
}
}
}
while(!Done);
if(Success)
{
Config -> ScreenConfig -> Depth = 0;
Config -> ScreenConfig -> OverscanType = OSCAN_TEXT;
Config -> ScreenConfig -> DisplayWidth = 0;
Config -> ScreenConfig -> DisplayHeight = 0;
}
}
LT_DeleteHandle(Handle);
}
DeleteList(ModeList);
}
}
else
{
struct TagItem DimensionTags[5];
struct ScreenModeRequester *Request;
struct Hook FilterHook;
LONG DisplayWidth,
DisplayHeight,
Depth,
MinDepth;
struct Rectangle DisplayClip;
Depth = Config -> ScreenConfig -> Depth;
FilterHook . h_Entry = (HOOKFUNC)ModeFilter;
FilterHook . h_SubEntry = NULL;
FilterHook . h_Data = NULL;
switch(Config -> ScreenConfig -> ColourMode)
{
case COLOUR_AMIGA:
MinDepth = 2;
break;
case COLOUR_EIGHT:
MinDepth = 3;
break;
case COLOUR_SIXTEEN:
MinDepth = 4;
break;
case COLOUR_MONO:
MinDepth = 1;
break;
}
if(Depth < MinDepth)
Depth = MinDepth;
if((!Config -> ScreenConfig -> DisplayWidth || !Config -> ScreenConfig -> DisplayHeight) && QueryOverscan(Config -> ScreenConfig -> DisplayMode,&DisplayClip,Config -> ScreenConfig -> OverscanType))
{
DisplayWidth = DisplayClip . MaxX - DisplayClip . MinX + 1;
DisplayHeight = DisplayClip . MaxY - DisplayClip . MinY + 1;
}
else
{
DisplayWidth = Config -> ScreenConfig -> DisplayWidth;
DisplayHeight = Config -> ScreenConfig -> DisplayHeight;
}
if(Request = (struct ScreenModeRequester *)AllocAslRequestTags(ASL_ScreenModeRequest,
ASLSM_Window, Window,
ASLSM_InitialDisplayID, *CurrentMode,
ASLSM_FilterFunc, &FilterHook,
ASLSM_PrivateIDCMP, TRUE,
ASLSM_InitialDisplayDepth, Depth,
ASLSM_MinDepth, MinDepth,
ASLSM_MaxDepth, 8,
ASLSM_DoDepth, TRUE,
ASLSM_MinWidth, 640,
ASLSM_MinHeight, 200,
ASLSM_DoWidth, TRUE,
ASLSM_DoHeight, TRUE,
ASLSM_DoOverscanType, TRUE,
ASLSM_InitialOverscanType, Config -> ScreenConfig -> OverscanType,
DisplayWidth ? ASLSM_InitialDisplayWidth : TAG_IGNORE, DisplayWidth,
DisplayHeight ? ASLSM_InitialDisplayHeight : TAG_IGNORE, DisplayHeight,
TAG_DONE))
{
if(AslRequest(Request,GetDimensionTags(NULL,DimensionTags)))
{
PutDimensionTags(Window,Request -> sm_LeftEdge,Request -> sm_TopEdge,Request -> sm_Width,Request -> sm_Height);
*CurrentMode = Request -> sm_DisplayID;
if(Request -> sm_DisplayDepth == MinDepth)
Depth = 0;
else
Depth = Request -> sm_DisplayDepth;
Config -> ScreenConfig -> Depth = Depth;
Config -> ScreenConfig -> OverscanType = Request -> sm_OverscanType;
Config -> ScreenConfig -> DisplayWidth = Request -> sm_DisplayWidth;
Config -> ScreenConfig -> DisplayHeight = Request -> sm_DisplayHeight;
Success = TRUE;
}
FreeAslRequest(Request);
}
}
return(Success);
}
STATIC BOOLEAN __regargs
PenPanel(struct Window *Window,UWORD *Array,UWORD *DefaultArray,WORD Depth)
{
struct LayoutHandle *Handle;
UWORD PrivateArray[16];
BOOLEAN Result = FALSE;
CopyMem(Array,PrivateArray,sizeof(PrivateArray));
if(Handle = LT_CreateHandleTags(Window -> WScreen,
LH_LocaleHook, &LocaleHook,
LH_ExactClone, TRUE,
TAG_DONE))
{
struct Window *PanelWindow;
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_PENPANEL_DRAWING_PENS_TXT,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_PENPANEL_BACKGROUND_TXT,
GTPA_Depth, Depth,
LAPA_SmallPalette, TRUE,
LA_UWORD, &PrivateArray[BACKGROUNDPEN],
LA_Chars, 15,
LA_ID, 100 + BACKGROUNDPEN,
TAG_DONE);
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_PENPANEL_TEXT_TXT,
GTPA_Depth, Depth,
LAPA_SmallPalette, TRUE,
LA_UWORD, &PrivateArray[TEXTPEN],
LA_ID, 100 + TEXTPEN,
TAG_DONE);
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_PENPANEL_IMPORTANT_TEXT_TXT,
GTPA_Depth, Depth,
LAPA_SmallPalette, TRUE,
LA_UWORD, &PrivateArray[HIGHLIGHTTEXTPEN],
LA_ID, 100 + HIGHLIGHTTEXTPEN,
TAG_DONE);
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_PENPANEL_BRIGHT_EDGES_TXT,
GTPA_Depth, Depth,
LAPA_SmallPalette, TRUE,
LA_UWORD, &PrivateArray[SHINEPEN],
LA_ID, 100 + SHINEPEN,
TAG_DONE);
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_PENPANEL_DARK_EDGES_TXT,
GTPA_Depth, Depth,
LAPA_SmallPalette, TRUE,
LA_UWORD, &PrivateArray[SHADOWPEN],
LA_ID, 100 + SHADOWPEN,
TAG_DONE);
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_PENPANEL_FILLPEN_TXT,
GTPA_Depth, Depth,
LAPA_SmallPalette, TRUE,
LA_UWORD, &PrivateArray[FILLPEN],
LA_ID, 100 + FILLPEN,
TAG_DONE);
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_PENPANEL_FILLTEXTPEN_TXT,
GTPA_Depth, Depth,
LAPA_SmallPalette, TRUE,
LA_UWORD, &PrivateArray[FILLTEXTPEN],
LA_ID, 100 + FILLTEXTPEN,
TAG_DONE);
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_PENPANEL_BARFILLPEN_TXT,
GTPA_Depth, Depth,
LAPA_SmallPalette, TRUE,
LA_UWORD, &PrivateArray[BARBLOCKPEN],
LA_ID, 100 + BARBLOCKPEN,
TAG_DONE);
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_PENPANEL_BARTEXTPEN_TXT,
GTPA_Depth, Depth,
LAPA_SmallPalette, TRUE,
LA_UWORD, &PrivateArray[BARDETAILPEN],
LA_ID, 100 + BARDETAILPEN,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type,XBAR_KIND,
TAG_DONE);
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_PENPANEL_STANDARDPENS_TXT,
LA_ID, GAD_DEFAULT,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type,VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, XBAR_KIND,
LAXB_FullSize, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,LA_Type,HORIZONTAL_KIND,
LAGR_SameSize, TRUE,
LAGR_Spread, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_USE_GAD,
LA_ID, GAD_USE,
LABT_ReturnKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_CANCEL_GAD,
LA_ID, GAD_CANCEL,
LABT_EscKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
if(PanelWindow = LT_Layout(Handle,LocaleString(MSG_PENPANEL_SCREEN_DRAWING_PENS_TXT),NULL,0,0,IDCMP_CLOSEWINDOW,0,
LAWN_HelpHook, &GuideHook,
LAWN_Parent, Window,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_DragBar, TRUE,
WA_RMBTrap, TRUE,
WA_Activate, TRUE,
TAG_DONE))
{
struct IntuiMessage *Message;
BOOLEAN Done = FALSE;
ULONG MsgClass,
MsgQualifier;
UWORD MsgCode;
struct Gadget *MsgGadget;
WORD i;
PushWindow(PanelWindow);
LT_ShowWindow(Handle,TRUE);
GuideContext(CONTEXT_SCREEN);
do
{
if(Wait(PORTMASK(PanelWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
break;
while(Message = (struct IntuiMessage *)LT_GetIMsg(Handle))
{
MsgClass = Message -> Class;
MsgQualifier = Message -> Qualifier;
MsgCode = Message -> Code;
MsgGadget = (struct Gadget *)Message -> IAddress;
LT_ReplyIMsg(Message);
if(MsgClass == IDCMP_CLOSEWINDOW)
Done = TRUE;
if(MsgClass == IDCMP_GADGETUP)
{
switch(MsgGadget -> GadgetID)
{
case GAD_USE:
CopyMem(PrivateArray,Array,sizeof(PrivateArray));
Array[DETAILPEN] = PrivateArray[BACKGROUNDPEN];
Array[BLOCKPEN] = PrivateArray[SHADOWPEN];
Array[BARTRIMPEN] = PrivateArray[BARDETAILPEN];
Result = Done = TRUE;
break;
case GAD_CANCEL:
Done = TRUE;
break;
case GAD_DEFAULT:
for(i = TEXTPEN ; i <= BARBLOCKPEN ; i++)
LT_SetAttributes(Handle,100 + i,GTPA_Color,DefaultArray[i],TAG_DONE);
break;
}
}
}
}
while(!Done);
PopWindow();
}
LT_DeleteHandle(Handle);
}
return(Result);
}
BYTE __regargs
ScreenPanel(struct Configuration *LocalConfig,BYTE *Default)
{
STATIC LONG PageTitleID[6] =
{
MSG_V36_0163,
MSG_V36_0164,
MSG_V36_0165,
MSG_V36_0166,
MSG_PENPANEL_DRAWING_PENS_TXT,
-1
};
STATIC BYTE InitialPage = 0;
struct LayoutHandle *Handle;
BYTE Cancel = FALSE;
STRPTR PageTitle[6];
LocalizeStringTable(PageTitle,PageTitleID);
SaveConfig(LocalConfig,PrivateConfig);
if(!LocalConfig -> ScreenConfig -> UseColours96)
{
Colour12x96(LocalConfig -> ScreenConfig -> Colours,LocalConfig -> ScreenConfig -> Colours96,16);
LocalConfig -> ScreenConfig -> UseColours96 = TRUE;
}
if(Handle = LT_CreateHandleTags(Window -> WScreen,
LH_LocaleHook, &LocaleHook,
LH_ExactClone, TRUE,
LH_ExitFlush, FALSE,
TAG_DONE))
{
struct Window *LocalWindow;
UBYTE ModeName[DISPLAYNAMELEN + 1],
FontName[MAX_FILENAME_LENGTH];
ULONG DisplayMode;
BOOL WrongMode = IsWrongMode(LocalConfig,PrivateConfig -> ScreenConfig -> ColourMode);
DisplayMode = LocalConfig -> ScreenConfig -> DisplayMode;
if(ModeNotAvailable(DisplayMode))
{
struct Screen *PubScreen = LockPubScreen(NULL);
if(PubScreen)
{
struct DimensionInfo DimensionInfo;
DisplayMode = GetVPModeID(&PubScreen -> ViewPort);
if(GetDisplayInfoData(NULL,(APTR)&DimensionInfo,sizeof(struct DimensionInfo),DTAG_DIMS,DisplayMode))
{
LONG Width = DimensionInfo . TxtOScan . MaxX - DimensionInfo . TxtOScan . MinX + 1,
Height = DimensionInfo . TxtOScan . MaxY - DimensionInfo . TxtOScan . MinY + 1;
if(Width != LocalConfig -> ScreenConfig -> DisplayWidth && LocalConfig -> ScreenConfig -> DisplayWidth)
LocalConfig -> ScreenConfig -> DisplayWidth = Width;
if(Height != LocalConfig -> ScreenConfig -> DisplayHeight && LocalConfig -> ScreenConfig -> DisplayHeight)
LocalConfig -> ScreenConfig -> DisplayHeight = Height;
}
UnlockPubScreen(NULL,PubScreen);
}
else
DisplayMode = DEFAULT_MONITOR_ID | HIRES_KEY;
}
strcpy(ModeName,GetModeName(DisplayMode));
BuildFontName(FontName,LocalConfig -> ScreenConfig -> FontName,LocalConfig -> ScreenConfig -> FontHeight);
if(!Screen || LocalConfig -> ScreenConfig -> ColourMode != Config -> ScreenConfig -> ColourMode)
{
if(Kick30)
{
if(InitialPage > 2)
InitialPage = 2;
PageTitle[3] = NULL;
}
else
{
if(InitialPage > 3)
InitialPage = 3;
PageTitle[4] = NULL;
}
}
else
PageTitle[5] = NULL;
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type,VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, CYCLE_KIND,
LA_ID, GAD_PAGER,
LA_LabelID, MSG_XFER_PAGE_TXT,
GTCY_Labels, PageTitle,
LACY_AutoPageID,GAD_PAGEGROUP,
LACY_TabKey, TRUE,
LA_BYTE, &InitialPage,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_ID, GAD_PAGEGROUP,
LAGR_Frame, TRUE,
LAGR_ActivePage,InitialPage,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, TEXT_KIND,
LA_LabelID, MSG_SCREENPANEL_CURRENT_DISPLAY_MODE_GAD,
LA_Chars, 20,
LA_ID, GAD_SCREENMODE,
GTTX_Text, ModeName,
GTTX_Border, TRUE,
LATX_Picker, TRUE,
LATX_LockSize, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, TEXT_KIND,
LA_LabelID, MSG_SCREENPANEL_SCREEN_FONT_GAD,
LA_Chars, 20,
LA_ID, GAD_FONT,
GTTX_Text, FontName,
GTTX_Border, TRUE,
LATX_Picker, TRUE,
LATX_LockSize, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
if(Kick30)
{
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_LabelID, MSG_SCREENPANEL_FASTER_LAYOUT_GAD,
LA_BYTE, &LocalConfig -> ScreenConfig -> FasterLayout,
TAG_DONE);
}
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_LabelID, MSG_SCREENPANEL_MAKE_SCREEN_PUBLIC_GAD,
LA_BYTE, &LocalConfig -> ScreenConfig -> MakeScreenPublic,
LA_ID, GAD_MAKESCREENPUBLIC,
GA_Disabled, LocalConfig -> ScreenConfig -> UseWorkbench,
TAG_DONE);
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_ID, GAD_SHANGHAI,
LA_LabelID, MSG_SCREENPANEL_SHANGHAI_WINDOWS_GAD,
LA_BYTE, &LocalConfig -> ScreenConfig -> ShanghaiWindows,
GA_Disabled, LocalConfig -> ScreenConfig -> UseWorkbench,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, XBAR_KIND,
TAG_DONE);
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_ID, GAD_USE_PUBSCREEN,
LA_LabelID, MSG_SCREENPANEL_USE_WORKBENCH_GAD,
LA_BYTE, &LocalConfig -> ScreenConfig -> UseWorkbench,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, STRING_KIND,
LA_LabelID, MSG_SCREENPANEL_PUBSCREEN_NAME_GAD,
LA_ID, GAD_PUBSCREENNAME,
LA_STRPTR, LocalConfig -> ScreenConfig -> PubScreenName,
LA_Chars, 14,
GTST_MaxChars, MAXPUBSCREENNAME,
LAST_Picker, TRUE,
GA_Disabled, !LocalConfig -> ScreenConfig -> UseWorkbench,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_LabelID, MSG_SCREENPANEL_SCREEN_TITLE_GAD,
LA_BYTE, &LocalConfig -> ScreenConfig -> TitleBar,
LA_ID, GAD_SCREENTITLE,
GA_Disabled, LocalConfig -> ScreenConfig -> UseWorkbench,
TAG_DONE);
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_LabelID, MSG_SCREENPANEL_WINDOW_BORDER_TXT,
LA_BYTE, &LocalConfig -> ScreenConfig -> ShareScreen,
LA_ID, GAD_WINDOW_BORDER,
GA_Disabled, LocalConfig -> ScreenConfig -> UseWorkbench,
TAG_DONE);
LT_New(Handle,
LA_Type, XBAR_KIND,
TAG_DONE);
LocalConfig -> ScreenConfig -> StatusLine &= 0xF;
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_LabelID, MSG_SCREENPANEL_SEPARATE_STATUS_WINDOW_TXT,
LA_BYTE, &LocalConfig -> ScreenConfig -> SplitStatus,
LA_ID, GAD_SPLIT_STATUS,
GA_Disabled, !LocalConfig -> ScreenConfig -> StatusLine || (!LocalConfig -> ScreenConfig -> ShareScreen && !LocalConfig -> ScreenConfig -> UseWorkbench),
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, CYCLE_KIND,
LA_LabelID, MSG_SCREENPANEL_STATUS_LINE_GAD,
LA_BYTE, &LocalConfig -> ScreenConfig -> StatusLine,
LACY_FirstLabel,MSG_SCREENPANEL_STATUS_DISABLED_TXT,
LACY_LastLabel, MSG_SCREENPANEL_STATUS_COMPACT_TXT,
LA_ID, GAD_STATUS_LINE,
TAG_DONE);
LT_New(Handle,
LA_Type, CYCLE_KIND,
LA_LabelID, MSG_SCREENPANEL_ONLINE_TIME_GAD,
LA_BYTE, &LocalConfig -> ScreenConfig -> TimeMode,
LACY_FirstLabel,MSG_SCREENPANEL_TIME_ONLINETIME_TXT,
LACY_LastLabel, MSG_SCREENPANEL_TIME_BOTH_TXT,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, MX_KIND,
LA_LabelID, MSG_SCREENPANEL_COLOUR_GAD,
LA_WORD, &LocalConfig -> ScreenConfig -> ColourMode,
LA_ID, GAD_COLOURMODE,
LAMX_FirstLabel,MSG_SCREENPANEL_COLOUR_AMIGA_TXT,
LAMX_LastLabel, MSG_SCREENPANEL_COLOUR_MONO_TXT,
TAG_DONE);
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_LabelID, MSG_SCREENPANEL_BLINKING_GAD,
LA_ID, GAD_BLINKING,
LA_BYTE, &LocalConfig -> ScreenConfig -> Blinking,
GA_Disabled, LocalConfig -> ScreenConfig -> UseWorkbench || LocalConfig -> ScreenConfig -> ColourMode == COLOUR_MONO,
LA_ExtraSpace, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
if(Screen && LocalConfig -> ScreenConfig -> ColourMode == Config -> ScreenConfig -> ColourMode)
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LONG Depth;
switch(LocalConfig -> ScreenConfig -> ColourMode)
{
case COLOUR_MONO:
Depth = 1;
break;
case COLOUR_AMIGA:
Depth = 2;
break;
case COLOUR_EIGHT:
Depth = 3;
break;
case COLOUR_SIXTEEN:
Depth = 4;
break;
}
if(LocalConfig -> ScreenConfig -> UseWorkbench)
{
LONG i,MaxDepth = 4;
for(i = 0 ; i < 4 ; i++)
{
if((1L << i) > Window -> WScreen -> ViewPort . ColorMap -> Count)
{
MaxDepth = i;
break;
}
}
if(Depth > MaxDepth)
Depth = MaxDepth;
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
WORD ColourMax;
STRPTR ColourFormat;
if(Kick30)
{
ColourMax = 255;
ColourFormat = "%3ld";
}
else
{
ColourMax = 15;
ColourFormat = "%2ld";
}
LT_New(Handle,
LA_Type, PALETTE_KIND,
LA_LabelID, MSG_SCREENPANEL_EDIT_SCREEN_PALETTE_GAD,
LA_ID, GAD_PALETTE,
LA_Chars, 12,
GTPA_Depth, Depth,
GA_Disabled, WrongMode,
TAG_DONE);
LT_New(Handle,
LA_Type, SliderType,
LA_LabelID, MSG_SCREENPANEL_RED_GAD,
LA_ID, GAD_RED,
GTSL_Min, 0,
GTSL_Max, ColourMax,
GTSL_Level, 0,
GTSL_LevelFormat, ColourFormat,
GA_Disabled, WrongMode,
TAG_DONE);
LT_New(Handle,
LA_Type, SliderType,
LA_LabelID, MSG_SCREENPANEL_GREEN_GAD,
LA_ID, GAD_GREEN,
GTSL_Min, 0,
GTSL_Max, ColourMax,
GTSL_Level, 0,
GTSL_LevelFormat, ColourFormat,
GA_Disabled, WrongMode,
TAG_DONE);
LT_New(Handle,
LA_Type, SliderType,
LA_LabelID, MSG_SCREENPANEL_BLUE_GAD,
LA_ID, GAD_BLUE,
GTSL_Min, 0,
GTSL_Max, ColourMax,
GTSL_Level, 0,
GTSL_LevelFormat, ColourFormat,
GA_Disabled, WrongMode,
TAG_DONE);
LT_New(Handle,
LA_Type, XBAR_KIND,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_SCREENPANEL_USE_DEFAULT_TXT,
LA_ID, GAD_RESET,
LA_Chars, 16,
GA_Disabled, WrongMode,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
if(Kick30)
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, CHECKBOX_KIND,
LA_LabelID, MSG_PENPANEL_STANDARDPENS_TXT,
LA_ID, GAD_STDPENS,
LA_BYTE, &LocalConfig -> ScreenConfig -> UsePens,
GA_Disabled, LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_PENPANEL_EDITPENS_TXT,
LA_ID, GAD_EDITPENS,
GA_Disabled, LocalConfig -> ScreenConfig -> UsePens || LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
}
}
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,LA_Type,XBAR_KIND,LAXB_FullSize,TRUE,TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,LA_Type,HORIZONTAL_KIND,
LAGR_SameSize, TRUE,
LAGR_Spread, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_USE_GAD,
LA_ID, GAD_USE,
LABT_ReturnKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
if(Default)
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_DEFAULT_GAD,
LA_ID, GAD_DEFAULT,
LABT_ExtraFat, TRUE,
TAG_DONE);
}
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_CANCEL_GAD,
LA_ID, GAD_CANCEL,
LABT_EscKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
if(LocalWindow = LT_Layout(Handle,LocaleString(MSG_SCREENPANEL_SCREEN_PREFERENCES_TXT),NULL,0,0,IDCMP_CLOSEWINDOW,0,
LAWN_HelpHook, &GuideHook,
LAWN_Parent, Window,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_DragBar, TRUE,
WA_RMBTrap, TRUE,
WA_Activate, TRUE,
TAG_DONE))
{
struct IntuiMessage *Message;
BOOLEAN Done = FALSE;
ULONG MsgClass,
MsgQualifier;
UWORD MsgCode;
struct Gadget *MsgGadget;
WORD ColourNumber = 0,Count,i;
WORD Red,Green,Blue;
struct ViewPort *LocalVPort = &LocalWindow -> WScreen -> ViewPort;
UWORD *DefaultPens,Depth;
switch(LocalConfig -> ScreenConfig -> ColourMode)
{
case COLOUR_MONO:
DefaultPens = MonoPens;
Depth = 1;
break;
case COLOUR_AMIGA:
DefaultPens = StandardPens;
Depth = 2;
break;
case COLOUR_EIGHT:
DefaultPens = ANSIPens;
Depth = 3;
break;
case COLOUR_SIXTEEN:
if(IntuitionBase -> LibNode . lib_Version >= 39)
DefaultPens = NewEGAPens;
else
DefaultPens = EGAPens;
Depth = 4;
break;
}
for(Count = 0, i = DETAILPEN ; i <= BARTRIMPEN ; i++)
{
if(LocalConfig -> ScreenConfig -> PenArray[i])
Count++;
}
if(!Count)
CopyMem(DefaultPens,LocalConfig -> ScreenConfig -> PenArray,16 * sizeof(UWORD));
LocalConfig -> ScreenConfig -> DisplayMode = DisplayMode;
if(!WrongMode)
{
if(Kick30)
{
Red = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] >> 24;
Green = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] >> 24;
Blue = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] >> 24;
}
else
{
Red = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 8) & 0xF;
Green = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 4) & 0xF;
Blue = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] ) & 0xF;
}
LT_SetAttributes(Handle,GAD_RED, GTSL_Level, Red, TAG_DONE);
LT_SetAttributes(Handle,GAD_GREEN, GTSL_Level, Green, TAG_DONE);
LT_SetAttributes(Handle,GAD_BLUE, GTSL_Level, Blue, TAG_DONE);
if(Screen)
{
LoadColourTable(VPort, NormalColourTable,NormalColours,PaletteSize);
LoadColourTable(LocalVPort, NormalColourTable,NormalColours,PaletteSize);
}
}
GuideContext(CONTEXT_SCREEN);
PushWindow(LocalWindow);
LT_ShowWindow(Handle,TRUE);
do
{
if(Wait(PORTMASK(LocalWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
{
SaveConfig(PrivateConfig,LocalConfig);
if(!Config -> ScreenConfig -> UseWorkbench && Screen)
{
if(!memcmp(Config -> ScreenConfig -> Colours96,LocalConfig -> ScreenConfig -> Colours96,sizeof(ULONG) * 3 * 16))
PaletteSetup(LocalConfig);
else
PaletteSetup(Config);
LoadColourTable(VPort, NormalColourTable,NormalColours,PaletteSize);
LoadColourTable(LocalVPort, NormalColourTable,NormalColours,PaletteSize);
}
break;
}
while(Message = (struct IntuiMessage *)LT_GetIMsg(Handle))
{
MsgClass = Message -> Class;
MsgQualifier = Message -> Qualifier;
MsgCode = Message -> Code;
MsgGadget = (struct Gadget *)Message -> IAddress;
LT_ReplyIMsg(Message);
if(MsgClass == IDCMP_CLOSEWINDOW)
{
SaveConfig(PrivateConfig,LocalConfig);
if(!Config -> ScreenConfig -> UseWorkbench && Screen)
{
if(!memcmp(Config -> ScreenConfig -> Colours96,LocalConfig -> ScreenConfig -> Colours96,sizeof(ULONG) * 3 * 16))
PaletteSetup(LocalConfig);
else
PaletteSetup(Config);
LoadColourTable(VPort, NormalColourTable,NormalColours,PaletteSize);
LoadColourTable(LocalVPort, NormalColourTable,NormalColours,PaletteSize);
}
Done = TRUE;
}
if(MsgClass == IDCMP_MOUSEMOVE)
{
switch(MsgGadget -> GadgetID)
{
case GAD_RED:
Red = MsgCode;
if(Kick30)
LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] = SPREAD(Red);
else
LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] = SPREAD((Red << 4) | Red);
PaletteSetup(LocalConfig);
LoadColourTable(VPort, NormalColourTable,NormalColours,PaletteSize);
LoadColourTable(LocalVPort, NormalColourTable,NormalColours,PaletteSize);
break;
case GAD_GREEN:
Green = MsgCode;
if(Kick30)
LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] = SPREAD(Green);
else
LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] = SPREAD((Green << 4) | Green);
PaletteSetup(LocalConfig);
LoadColourTable(VPort, NormalColourTable,NormalColours,PaletteSize);
LoadColourTable(LocalVPort, NormalColourTable,NormalColours,PaletteSize);
break;
case GAD_BLUE:
Blue = MsgCode;
if(Kick30)
LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] = SPREAD(Blue);
else
LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] = SPREAD((Blue << 4) | Blue);
PaletteSetup(LocalConfig);
LoadColourTable(VPort, NormalColourTable,NormalColours,PaletteSize);
LoadColourTable(LocalVPort, NormalColourTable,NormalColours,PaletteSize);
break;
}
}
if(MsgClass == IDCMP_GADGETUP)
{
switch(MsgGadget -> GadgetID)
{
case GAD_STDPENS:
LT_SetAttributes(Handle,GAD_EDITPENS,
GA_Disabled,LocalConfig -> ScreenConfig -> UsePens || LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
TAG_DONE);
break;
case GAD_USE_PUBSCREEN:
LT_SetAttributes(Handle,GAD_PUBSCREENNAME,GA_Disabled,!LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
LT_SetAttributes(Handle,GAD_MAKESCREENPUBLIC,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
LT_SetAttributes(Handle,GAD_SHANGHAI,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
LT_SetAttributes(Handle,GAD_SCREENTITLE,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
LT_SetAttributes(Handle,GAD_WINDOW_BORDER,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
LT_SetAttributes(Handle,GAD_BLINKING,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench || LocalConfig -> ScreenConfig -> ColourMode == COLOUR_MONO,TAG_DONE);
LT_SetAttributes(Handle,GAD_SPLIT_STATUS,GA_Disabled,!LocalConfig -> ScreenConfig -> StatusLine || (!LocalConfig -> ScreenConfig -> ShareScreen && !LocalConfig -> ScreenConfig -> UseWorkbench),TAG_DONE);
WrongMode = IsWrongMode(LocalConfig,PrivateConfig -> ScreenConfig -> ColourMode);
LT_SetAttributes(Handle,GAD_PALETTE,GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_RED,GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_GREEN,GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_BLUE,GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_RESET,GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_EDITPENS,
GA_Disabled, LocalConfig -> ScreenConfig -> UsePens || LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
TAG_DONE);
LT_SetAttributes(Handle,GAD_STDPENS,
GTCB_Checked, LocalConfig -> ScreenConfig -> UsePens = TRUE,
GA_Disabled, LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
TAG_DONE);
break;
case GAD_WINDOW_BORDER:
LT_SetAttributes(Handle,GAD_SPLIT_STATUS,GA_Disabled,!LocalConfig -> ScreenConfig -> StatusLine || (!LocalConfig -> ScreenConfig -> ShareScreen && !LocalConfig -> ScreenConfig -> UseWorkbench),TAG_DONE);
break;
case GAD_COLOURMODE:
if(!ModeOkay(LocalConfig -> ScreenConfig -> DisplayMode) && LocalConfig -> ScreenConfig -> ColourMode > COLOUR_AMIGA)
LT_SetAttributes(Handle,GAD_COLOURMODE,GTCY_Active,COLOUR_AMIGA,TAG_DONE);
WrongMode = IsWrongMode(LocalConfig,PrivateConfig -> ScreenConfig -> ColourMode);
LT_SetAttributes(Handle,GAD_PALETTE, GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_RED, GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_GREEN, GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_BLUE, GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_RESET, GA_Disabled,WrongMode,TAG_DONE);
LT_SetAttributes(Handle,GAD_BLINKING,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench || LocalConfig -> ScreenConfig -> ColourMode == COLOUR_MONO,TAG_DONE);
switch(LocalConfig -> ScreenConfig -> ColourMode)
{
case COLOUR_MONO:
DefaultPens = MonoPens;
Depth = 1;
break;
case COLOUR_AMIGA:
DefaultPens = StandardPens;
Depth = 2;
break;
case COLOUR_EIGHT:
DefaultPens = ANSIPens;
Depth = 3;
break;
case COLOUR_SIXTEEN:
DefaultPens = EGAPens;
Depth = 4;
break;
}
LT_SetAttributes(Handle,GAD_EDITPENS,
GA_Disabled, LocalConfig -> ScreenConfig -> UsePens || LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
TAG_DONE);
LT_SetAttributes(Handle,GAD_STDPENS,
GA_Disabled, LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
TAG_DONE);
break;
case GAD_EDITPENS:
LT_LockWindow(LocalWindow);
if(LocalConfig -> ScreenConfig -> PenColourMode != LocalConfig -> ScreenConfig -> ColourMode)
{
UWORD LocalPens[16];
CopyMem(DefaultPens,LocalPens,16 * sizeof(UWORD));
if(PenPanel(LocalWindow,LocalPens,DefaultPens,Depth))
{
CopyMem(LocalPens,LocalConfig -> ScreenConfig -> PenArray,16 * sizeof(UWORD));
LocalConfig -> ScreenConfig -> PenColourMode = LocalConfig -> ScreenConfig -> ColourMode;
}
}
else
PenPanel(LocalWindow,LocalConfig -> ScreenConfig -> PenArray,DefaultPens,Depth);
LT_UnlockWindow(LocalWindow);
LT_ShowWindow(Handle,TRUE);
break;
case GAD_MAKESCREENPUBLIC:
LT_SetAttributes(Handle,GAD_SHANGHAI,
GA_Disabled, !LocalConfig -> ScreenConfig -> MakeScreenPublic || LocalConfig -> ScreenConfig -> UseWorkbench,
TAG_DONE);
break;
case GAD_PALETTE:
ColourNumber = MsgCode;
if(Kick30)
{
Red = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] >> 24;
Green = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] >> 24;
Blue = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] >> 24;
}
else
{
Red = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 8) & 0xF;
Green = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 4) & 0xF;
Blue = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] ) & 0xF;
}
LT_SetAttributes(Handle,GAD_RED, GTSL_Level, Red, TAG_DONE);
LT_SetAttributes(Handle,GAD_GREEN, GTSL_Level, Green, TAG_DONE);
LT_SetAttributes(Handle,GAD_BLUE, GTSL_Level, Blue, TAG_DONE);
break;
case GAD_RESET:
Default2CurrentPalette(LocalConfig);
if(Kick30)
{
Red = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] >> 24;
Green = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] >> 24;
Blue = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] >> 24;
}
else
{
Red = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 8) & 0xF;
Green = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 4) & 0xF;
Blue = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] ) & 0xF;
}
LT_SetAttributes(Handle,GAD_RED, GTSL_Level, Red, TAG_DONE);
LT_SetAttributes(Handle,GAD_GREEN, GTSL_Level, Green, TAG_DONE);
LT_SetAttributes(Handle,GAD_BLUE, GTSL_Level, Blue, TAG_DONE);
PaletteSetup(LocalConfig);
LoadColourTable(VPort, NormalColourTable,NormalColours,PaletteSize);
LoadColourTable(LocalVPort, NormalColourTable,NormalColours,PaletteSize);
break;
case GAD_USE:
LT_UpdateStrings(Handle);
if(!WrongMode)
PaletteSetup(LocalConfig);
else
{
if(LocalConfig -> ScreenConfig -> ColourMode != PrivateConfig -> ScreenConfig -> ColourMode)
Default2CurrentPalette(LocalConfig);
}
if(LocalConfig -> ScreenConfig -> PenColourMode != LocalConfig -> ScreenConfig -> ColourMode)
{
CopyMem(DefaultPens,LocalConfig -> ScreenConfig -> PenArray,16 * sizeof(UWORD));
LocalConfig -> ScreenConfig -> PenColourMode = LocalConfig -> ScreenConfig -> ColourMode;
}
Done = TRUE;
break;
case GAD_CANCEL:
SaveConfig(PrivateConfig,LocalConfig);
if(!Config -> ScreenConfig -> UseWorkbench && Screen)
{
if(!memcmp(Config -> ScreenConfig -> Colours96,LocalConfig -> ScreenConfig -> Colours96,sizeof(ULONG) * 3 * 16))
PaletteSetup(LocalConfig);
else
PaletteSetup(Config);
LoadColourTable(VPort, NormalColourTable,NormalColours,PaletteSize);
LoadColourTable(LocalVPort, NormalColourTable,NormalColours,PaletteSize);
}
Cancel = Done = TRUE;
break;
case GAD_DEFAULT:
*Default = TRUE;
SaveConfig(PrivateConfig,LocalConfig);
if(!Config -> ScreenConfig -> UseWorkbench && Screen)
{
if(!memcmp(Config -> ScreenConfig -> Colours96,LocalConfig -> ScreenConfig -> Colours96,sizeof(ULONG) * 3 * 16))
PaletteSetup(LocalConfig);
else
PaletteSetup(Config);
LoadColourTable(VPort, NormalColourTable,NormalColours,PaletteSize);
LoadColourTable(LocalVPort, NormalColourTable,NormalColours,PaletteSize);
}
Done = TRUE;
break;
}
}
if(MsgClass == IDCMP_IDCMPUPDATE)
{
switch(MsgGadget -> GadgetID)
{
case GAD_FONT:
LT_LockWindow(LocalWindow);
if(PickFont(LocalWindow,LocalConfig -> ScreenConfig -> FontName,&LocalConfig -> ScreenConfig -> FontHeight,FALSE))
{
BuildFontName(FontName,LocalConfig -> ScreenConfig -> FontName,LocalConfig -> ScreenConfig -> FontHeight);
LT_SetAttributes(Handle,GAD_FONT,
GTTX_Text, FontName,
TAG_DONE);
}
LT_UnlockWindow(LocalWindow);
break;
case GAD_SCREENMODE:
LT_LockWindow(LocalWindow);
if(SelectDisplayMode(LocalWindow,&LocalConfig -> ScreenConfig -> DisplayMode,LocalConfig))
{
strcpy(ModeName,GetModeName(LocalConfig -> ScreenConfig -> DisplayMode));
LT_SetAttributes(Handle,GAD_SCREENMODE,GTTX_Text,ModeName,TAG_DONE);
}
LT_UnlockWindow(LocalWindow);
LT_ShowWindow(Handle,TRUE);
break;
case GAD_STATUS_LINE:
LT_SetAttributes(Handle,GAD_SPLIT_STATUS,GA_Disabled,!LocalConfig -> ScreenConfig -> StatusLine || (!LocalConfig -> ScreenConfig -> ShareScreen && !LocalConfig -> ScreenConfig -> UseWorkbench),TAG_DONE);
break;
case GAD_PUBSCREENNAME:
if(LocalConfig -> ScreenConfig -> UseWorkbench)
{
UBYTE DummyBuffer[MAXPUBSCREENNAME + 1];
LT_LockWindow(LocalWindow);
strcpy(DummyBuffer,(STRPTR)LT_GetAttributes(Handle,GAD_PUBSCREENNAME,TAG_DONE));
strcpy(SharedBuffer,DummyBuffer);
if(PickScreen(LocalWindow,DummyBuffer))
{
if(strcmp(DummyBuffer,SharedBuffer))
LT_SetAttributes(Handle,GAD_PUBSCREENNAME,GTST_String,DummyBuffer,TAG_DONE);
}
LT_UnlockWindow(LocalWindow);
LT_ShowWindow(Handle,TRUE);
}
break;
}
}
}
}
while(!Done);
PopWindow();
}
LT_DeleteHandle(Handle);
}
if(Default)
return((BYTE)(!Cancel));
else
{
if(PrivateConfig -> ScreenConfig -> DisplayMode != LocalConfig -> ScreenConfig -> DisplayMode || Stricmp(PrivateConfig -> ScreenConfig -> FontName,LocalConfig -> ScreenConfig -> FontName) || PrivateConfig -> ScreenConfig -> FontHeight != LocalConfig -> ScreenConfig -> FontHeight || PrivateConfig -> ScreenConfig -> ColourMode != LocalConfig -> ScreenConfig -> ColourMode)
return(TRUE);
if(PrivateConfig -> ScreenConfig -> MakeScreenPublic != LocalConfig -> ScreenConfig -> MakeScreenPublic || PrivateConfig -> ScreenConfig -> ShanghaiWindows != LocalConfig -> ScreenConfig -> ShanghaiWindows)
return(TRUE);
if(PrivateConfig -> ScreenConfig -> Blinking != LocalConfig -> ScreenConfig -> Blinking && (LocalConfig -> ScreenConfig -> ColourMode == COLOUR_EIGHT || LocalConfig -> ScreenConfig -> ColourMode == COLOUR_SIXTEEN))
return(TRUE);
if(PrivateConfig -> ScreenConfig -> FasterLayout != LocalConfig -> ScreenConfig -> FasterLayout && LocalConfig -> ScreenConfig -> ColourMode != COLOUR_MONO)
return(TRUE);
if(PrivateConfig -> ScreenConfig -> TitleBar != LocalConfig -> ScreenConfig -> TitleBar || PrivateConfig -> ScreenConfig -> StatusLine != LocalConfig -> ScreenConfig -> StatusLine || PrivateConfig -> ScreenConfig -> UseWorkbench != LocalConfig -> ScreenConfig -> UseWorkbench || PrivateConfig -> ScreenConfig -> Depth != LocalConfig -> ScreenConfig -> Depth || PrivateConfig -> ScreenConfig -> OverscanType != LocalConfig -> ScreenConfig -> OverscanType || PrivateConfig -> ScreenConfig -> DisplayWidth != LocalConfig -> ScreenConfig -> DisplayWidth || PrivateConfig -> ScreenConfig -> DisplayHeight != LocalConfig -> ScreenConfig -> DisplayHeight)
return(TRUE);
if(PrivateConfig -> ScreenConfig -> ShareScreen != LocalConfig -> ScreenConfig -> ShareScreen || PrivateConfig -> ScreenConfig -> SplitStatus != LocalConfig -> ScreenConfig -> SplitStatus)
return(TRUE);
if(strcmp(PrivateConfig -> ScreenConfig -> PubScreenName,LocalConfig -> ScreenConfig -> PubScreenName) && LocalConfig -> ScreenConfig -> UseWorkbench)
return(TRUE);
if(LocalConfig -> ScreenConfig -> UsePens != PrivateConfig -> ScreenConfig -> UsePens || memcmp(LocalConfig -> ScreenConfig -> PenArray,PrivateConfig -> ScreenConfig -> PenArray,sizeof(UWORD) * 12))
return(TRUE);
return(FALSE);
}
}